' //***************************************************************************
' // ***** Script Header *****
' //
' // Solution:  Solution Accelerator for Business Desktop Deployment
' // File:      LiteTouch.vbs
' //
' // Purpose:   Start the lite touch deployment process
' //
' // Usage:     cscript LiteTouch.vbs [/debug:true]
' //
' // Microsoft Solution Version:  3.0.11
' // Microsoft Script Version:    3.0.11
' // Customer Build Version:      1.0.0
' // Customer Script Version:     1.0.0
' //
' // Microsoft History:
' // 3.0.11 MTN  05/04/2006  Added comment block.
' //
' // Customer History:
' //
' // ***** End Header *****
' //***************************************************************************


'//----------------------------------------------------------------------------
'//
'//  Global constant and variable declarations
'//
'//----------------------------------------------------------------------------

Option Explicit

Dim oShell
Dim oFSO
Dim iRetVal
Dim sCmd
Dim sScriptDir
Dim sArg
Dim sArgString
Dim sArchitecture


'//----------------------------------------------------------------------------
'//  Initialization
'//----------------------------------------------------------------------------

Set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
sScriptDir = oFSO.GetParentFolderName(WScript.ScriptFullName)
For each sArg in WScript.Arguments
	sArgString = sArgString & sArg & " "
Next

sArchitecture = oShell.Environment("SYSTEM").Item("Processor_Architecture")
if lcase(sArchitecture) = "amd64" then
   sArchitecture = "x64"
end if


' Clean up any existing C:\MININT directory

If oFSO.FolderExists("C:\MININT") then
	On Error Resume Next
	oFSO.DeleteFolder "C:\MININT", true
	On Error Goto 0
End if


'//----------------------------------------------------------------------------
'//  Check to see if the prereq's have been satisfied
'//----------------------------------------------------------------------------

sCmd = "cscript.exe """ & sScriptDir & "\ZTIPrereq.vbs"""
iRetVal = oShell.Run(sCmd, 0, true)
If iRetVal <> 0 then
	oShell.Popup "This computer does not meet the prerequisites for deploying a new operating system.  (" & CStr(iRetVal) & ")", 0, "Prerequisite Error", 16
	WScript.Quit iRetVal
End if



'//----------------------------------------------------------------------------
'//  Launch LiteTouch.wsf to do the heavy lifting
'//----------------------------------------------------------------------------

sCmd = """" & sScriptDir & "\..\tools\" & sArchitecture & "\bddrun.exe"" wscript.exe """ & sScriptDir & "\LiteTouch.wsf"" " & sArgString
iRetVal = oShell.Run(sCmd, 1, true)


' All done

WScript.Quit iRetVal
